<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{$site_seo.title}</title>
    <meta name="keywords" content="{$site_seo.keywords}">
    <meta name="description" content="{$site_seo.description}">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <link rel="canonical" href="{:url("/chapter/" . $chapter['article_id'] . "/" . $chapter['id'],"","html","www")}"/>
    <link href="__CSS__/mobile.css" type="text/css" rel="stylesheet">

    <script src="__JS__/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="__JS__/layer/layer.js"></script>
    <script src="__JS__/chapter_m.js" type="text/javascript"></script>

</head>
<body class="chapter-body">
<div class="chapter-wrap font-family-01" style="font-size:1.125rem;">
    <!--main-->
    <div class="chapter-top">
        <a class="icon-back" href="{:url("/book/" . $article['id'],"","html",'m')}"></a>
        <h1>{$article.title}</h1>
        <!--<div class="source-list">-->
            <!--<div class="select">-->
                <!--<p data-value="{$chapter.flag}">{$chapter.source_name}</p>-->
                <!--<ul>-->
                    <!--{foreach $chapter.source_list as $item}-->
                    <!--<li data-flag="{$item.flag | base64_encode}" data-id="{$item.id}" data-value="{$item.site_name}" data-name="{$item.site_name}"  {eq name="$chapter.flag" value="$item.flag"} class="Selected" {/eq}>{$item.site_name}</li>-->
                    <!--{/foreach}-->
                <!--</ul>-->
            <!--</div>-->
        <!--</div>-->
    </div>

    <div class="chapter-main">
        <div class="title">
            <h2>{$chapter.title}</h2>
            <p>
                <span>作者：{$article.author}</span>
                <span class="word_len">字数：{$chapter.word_len}</span>
             </p>
        </div>

        <div class="content">
            <?php if($chapter['content'] != "empty") {echo $chapter['content'];}?>
        </div>
        <div class="clear"></div>
        <?php echo $showPage;?>
    </div>
    <div class="chapter-porn">
        {neq name="$prev" value=""}<a class="prev" href="{:url('/chapter/' . $article['id'] . '/' . $prev['id'],'html',true)}" target="_top" class="pre" >上一章</a>{else/}<a href="javascript:void(0)" class="pre no_pre_chapter" >暂无上一章</a>{/neq}
        <a class="index" href="{:url('/chapter_list/' . $article['id'],'html',true)}">返回目录</a>
        {neq name="$next" value=""}<a class="next" href="{:url('/chapter/' . $article['id'] . '/' . $next['id'],'html',true)}" rel="next">下一章</a>{else/}<a href="javascript:void(0)" class="no_next_chapter" rel="next">暂无下一章</a>{/neq}
    </div>
    <!--main-->
</div>
<!-- footer -->
<div class="footer">
    <div class="copyright">
        <p><a href="{$site_config.mobile_domain}" rel="index">{$site_config.site_name}</a>所有内容使用搜索引擎转码技术抓取自网络，如有侵犯版权，请来信告知，本站立即处理。</p>
        <p>Powered by BookCMS v{$site_config.version} Copyright © 2018 <a href="{$site_config.site_domain}" rel="index">{$site_config.site_name}</a> All rights reserved.</p>
    </div>
</div>

<script type="text/javascript">

    $(function(){

        function get_chapter_content(article_id,chapter_id,flag) {

            var layer1 = layer.load();
            $.ajax({
                type: "get",
                data:{
                    article_id:article_id,
                    chapter_id:chapter_id,
                    flag:flag,
                },
                cache:false,
                dataType:"json",
                url: '{:url("/ajax/chapter_content","","html",true)}',
                success: function(info) {
                    if (info.code == 0 && info.data != "") {
                        $(".content").html(info.data);
                        layer.close(layer1);
                    }
                }
            });
        }

        if ("{$chapter.content | strlen}" < 10) {
            $(".content").html("<div class='chapter_content_empty'>章节加载失败请点击右上角更换源阅读!</div>");
            setTimeout(function () {
                get_chapter_content("{$article.id}","{$chapter.id}","{$chapter.flag | base64_encode}");
            },500);
        }

        // $(".source-list .select p").click(function(e){
        //     $(".source-list .select").toggleClass('open');
        //     e.stopPropagation();
        // });
        //
        // $(".source-list .select ul li").click(function(e){
        //     var _this=$(this);
        //     $(".source-list .select > p").text(_this.attr('data-value'));
        //     _this.addClass("Selected").siblings().removeClass("Selected");
        //     $(".source-list .select").removeClass("open");
        //     e.stopPropagation();
        //
        //     $(".source_name").html("来源：" + _this.data('name'));
        //     get_chapter_content("{$article.id}",_this.data('id'),_this.data('flag'));
        // });
        //
        // $(document).on('click',function(){
        //     $(".source-list .select").removeClass("open");
        // })
    });

</script>
</body>
</html>